package cursojava.struts;

import java.sql.Connection;
import java.sql.DriverManager;

public class Datasource {
    private static Connection connection;

    public static Connection getConnection() throws Exception{
        if (connection == null){
            connection = conectarBD();
        }
        return connection;
    }
    
    private static final String CONNECTION_STRING = "jdbc:mysql://127.0.0.1:3306/Numero_Secreto";
    private static final String USUARIO = "root";
    private static final String PASSWORD = "Fuck_2_all";


    public static Connection conectarBD() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection c = DriverManager.getConnection(CONNECTION_STRING, USUARIO, PASSWORD);
        return c;

    }
}